package com.example.onion.hxchat.room.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * @author:onion
 * @data: 2020/7/8
 */
@Entity(tableName = "APPLY")
public class Apply {
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id", typeAffinity = ColumnInfo.INTEGER)
    public int id;

    @ColumnInfo(name = "userName", typeAffinity = ColumnInfo.TEXT)
    public String userName;//好友数据的用户名

    @ColumnInfo(name = "userId", typeAffinity = ColumnInfo.TEXT)
    public String userId; //好友数据的id

    @ColumnInfo(name = "applyContent", typeAffinity = ColumnInfo.TEXT)
    public String applyContent; //申请添加好友的验证信息

    @ColumnInfo(name = "ownerUseId", typeAffinity = ColumnInfo.TEXT)
    public String ownerUseId; //拥有此条好友申请数据的用户id


    /**
     * Room会使用这个构造器来存储数据，也就是当你从表中得到Student对象时候，Room会使用这个构造器
     */
    public Apply(int id, String userName, String userId, String applyContent, String ownerUseId) {
        this.id = id;
        this.userName = userName;
        this.userId = userId;
        this.applyContent = applyContent;
        this.ownerUseId = ownerUseId;
    }

    /**
     * 由于Room只能识别和使用一个构造器，如果希望定义多个构造器，你可以使用Ignore标签，让Room忽略这个构造器
     * 同样，@Ignore标签还可用于字段，使用@Ignore标签标记过的字段，Room不会持久化该字段的数据
     */
    @Ignore
    public Apply(String userName, String userId, String applyContent, String ownerUseId) {
        this.userName = userName;
        this.userId = userId;
        this.applyContent = applyContent;
        this.ownerUseId = ownerUseId;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setApplyContent(String applyContent) {
        this.applyContent = applyContent;
    }

    public void setOwnerUseId(String ownerUseId) {
        this.ownerUseId = ownerUseId;
    }

    public int getId() {
        return id;
    }

    public String getUserName() {
        return userName;
    }

    public String getUserId() {
        return userId;
    }

    public String getApplyContent() {
        return applyContent;
    }

    public String getOwnerUseId() {
        return ownerUseId;
    }
}
